<?php

namespace App\Admin\Grid\Tools\ShopProduct;

use Encore\Admin\Grid\Tools\AbstractTool;

class AllShopProductTools extends AbstractTool
{
    private int $status;

    private mixed $action;

    /**
     * @param int $status
     * @param string|null $action
     */
    public function __construct(int $status, ?string $action = null)
    {
        $this->status = $status;
        $this->action = $action;
    }

    public function render(): string
    {
        return view('tools.shopProduct.all', [
            'flag' => $this->status === 0 ? 'dropbox' : 'default',
            'action' => match($this->action) {
                'admin.plug.index' => 'plug',
                'admin.shopProductHelp.index' => 'shopProductHelp',
                default => 'shopProduct'
            },
        ]);
    }
}
